<?php if (isset($post) && !is_null($post)) : ?>

<div class="grid_9">

	<h2 class="alpha prefix_2 grid_4 suffix_3 omega"><?php echo $post->getTitle(); ?></h2>
	<div class="post-metadata grid_2 alpha">
		<div class="post-author">by <?php echo $post->getAuthorName(); ?></div>
		<div class="post-date"><?php echo $post->getDateCreatedLocal(); ?></div>
		<div class="post-links">
            <?php echo anchor('post/' . $post->getSlug() . '#comments', $post->getCommentCount() . ' comments'); ?>
            &middot; <?php echo anchor('post/' . $post->getSlug(), 'Permalink'); ?>
		</div>
		<div class="post-admin-links">
<?php if ($this->session->userdata('current_user_name') !== false) : ?>
<?php if ($this->session->userdata('is_admin')) : ?>
			<?php echo anchor('editPost/' . $post->getPostId(), 'Edit post &raquo;'); ?>
<?php endif; ?>
<?php endif; ?>
		</div>
	</div>	
	<div class="post grid_4">
        <?php echo $post->getContent(); ?>
	</div>
	<div class="post grid_3 omega">
		
	</div>
	<div class="clear"></div>

</div>

<div class="grid_6 suffix_3">
	
	<?php if (!empty($postComments)) : ?>
	
	<div id="comments">
		<h3 class="alpha prefix_2 grid_4 omega"><?php echo $post->getCommentCount(); ?> comments</h3>
		
		<?php foreach ($postComments as $comment) : ?>
		<div class="comment">
			<div class="alpha grid_2 comment-metadata">
				<div class="comment-timestamp"><a name="comment-<?php echo $comment->getCommentId(); ?>"><?php echo $comment->getDateCreatedLocal(); ?></a></div>
				<div class="comment-links"><a href="foo">Permalink</a></div>
			</div>
			<div class="omega grid_4 comment-content">
				<?php echo $comment->getComment(); ?>
			</div>
			<div class="clear"></div>
			<div class="alpha grid_2">&nbsp;</div>
			<div class="grid_4 omega comment-attribution"><a href="http://twitter.com/<?php echo $comment->getAuthorTwitterScreenName(); ?>"><?php echo $comment->getAuthorName(); ?></a></div>
			<div class="clear"></div>
		</div>
		<?php endforeach; ?>

	</div>
	
	<?php endif; ?>
	
	<div id="add-comment" class="alpha prefix_2 grid_4 omega">
		
		<h3>Add a comment</h3>
		<?php if ($currentUserName === false) : ?>
		<p>Please add a comment using your Twitter account. Don't have one? <a href="https://twitter.com/signup">Sign up</a>.</p>
		
		<div id="sign-in">
			<a href="<?php echo site_url('/auth'); ?>">
				<img src="/img/Sign-in-with-Twitter-lighter.png" alt="Sign in with Twitter" />
			</a>
		</div>
		<?php endif; ?>
		
	</div>
	<div class="clear"></div>
	
	<?php echo form_open('post/' . $post->getSlug(), array('id'=>'post-newCommentForm')); ?>
		<?php echo form_hidden('clickframesFormId', 'post-newCommentForm'); ?>
		<?php echo form_hidden('postId', $post->getPostId()); ?>
		
		<?php if ($currentUserName !== false) : ?>
		<label class="alpha prefix_1 grid_1">Your Name</label>
		<div class="omega grid_4 username">
			<em><?php echo $currentUserName; ?> (@<?php echo $this->session->userdata('current_user_screen_name'); ?>)</em><br />
			<span class="controls"><?php echo anchor('/ligature/logout', 'Log Out'); ?> &middot; <?php echo anchor('/ligature/auth/forceLogin', 'Log in as different user'); ?></span>
		</div>
		<?php endif; ?>
		
		<?php echo form_label('Comment', 'comment', array('class'=>'alpha prefix_1 grid_1')); ?>
		<div class="omega grid_4">
			<?php echo form_textarea(array('name'=>'comment', 'id'=>'comment', 'value'=>set_value('comment'), 'class'=>'width_4')); ?>
			<div class="message"><span id="comment_message"><?php echo form_error('comment'); ?></span></div>
			<div class="checkbox">
				<?php echo form_checkbox(array('name'=>'postTwitter', 'id'=>'postTwitter', 'value'=>'accept', 'checked'=>TRUE)); ?>
				<?php echo form_label('Also post my comment on Twitter', 'postTwitter'); ?>
			</div>
		</div>
		<div class="clear"></div>
		<div class="prefix_2 grid_4 alpha omega buttons">
			<?php echo form_submit(array('name'=>'action:addComment', 'id'=>'action:addComment', 'class'=>'width_2'), 'Add comment'); ?>
		</div>
		<div class="clear"></div>
	<?php echo form_close(); ?>

</div>

<?php if ($currentUserName === false) : ?>
<script type="text/javascript">
	disableForm('post-newCommentForm');
</script>
<?php endif; ?>
	
<?php else : ?>

<h2 class="prefix_1 grid_4 suffix_3">Sorry, that post doesn't exist.</h2>
	
<?php endif; ?>

<?php /* clickframes::version=3390920294::clickframes */ ?>